﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace NICRUtils
{
    class FileProcessor
    {
        // total size of file that can be read = infinite :).
        public int breakFile(String fileLocation, List<long> startLocationArray, int size, out byte[] dataArray) 
        {
            
            BufferedStream buffStream = new BufferedStream(new FileStream(fileLocation, FileMode.Open, FileAccess.Read));

            byte[] fileData = null;
            int tempSize = size;
            StringBuilder tempString = new StringBuilder();
           
            fileData = new byte[tempSize];
            for (int loop = 0; loop < startLocationArray.Count; loop++) {
                buffStream.Seek(startLocationArray[loop], SeekOrigin.Current);   
            }
            
            tempSize = buffStream.Read(fileData, 0, tempSize);
            buffStream.Close();
            new FileStream(@"D:\Demo.rar", FileMode.Append, FileAccess.Write).Write(fileData, 0, tempSize);
            dataArray = fileData;
                        
            return tempSize;
        }

        public void breakData(String fileData, long breakSize) {
            System.Security.Cryptography.ECDiffieHellman e = System.Security.Cryptography.ECDiffieHellman.Create();
            
        }
    }
}